package com.testyourshell.dao.user;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.testyourshell.dao.BaseDAOImpl;
import com.testyourshell.model.user.User;

@Repository
public class UserDAOImpl extends BaseDAOImpl<User> implements UserDAO {

	public User findByUsername(final String username) {
		Query query = sessionFactory.getCurrentSession().getNamedQuery(
				"User.findByUsername");
		query.setParameter("username", username);

		return (User) query.uniqueResult();
	}

	@Override
	protected Class<User> getEntityClass() {
		return User.class;
	}

}
